<?php
$nombre = $_POST["nombre"];
$tipo = $_POST["idTipo"];
$para = $_POST["idJug"];
$precio = $_POST["precio"];

include '../config/config.php';

$con = mysql_connect($host,$user,$passw);
mysql_select_db($dbname, $con);

// Create connection
//$con=mysqli_connect($host,$user,$passw,$dbname);

// Check connection
//if (mysqli_connect_errno()){
//echo "Failed to connect to MySQL: " . mysqli_connect_error();
//}
$query = "INSERT INTO encargo (nombre, tipo, precio, para) VALUES ('".$nombre."', ".$tipo.", ".$precio.", ".$para.")";

mysql_query($query, $con) or die(mysql_error());

echo mysql_insert_id($con);